import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class DataGen {
    public static void main(String[] args) throws IOException {

        BufferedWriter bw = new BufferedWriter(new FileWriter("data/students.txt"));

        for (int i = 0; i < 100000; i++) {
            //000001,zhangsan,18,male,beijing,18000,2018-07-01
            String stu_id = StringUtils.leftPad(i + "", 6, "0");
            String name = RandomStringUtils.randomAlphabetic(6);
            int age = RandomUtils.nextInt(18, 38);
            String gender = null;
            if (RandomUtils.nextInt() % 2 == 0) {
                gender = "male";
            } else {
                gender = "female";
            } ;


            String city = null;
            int flag = RandomUtils.nextInt() % 3;
            if ( flag== 0) {
                city = "北京";
            } else if(flag==1){
                city = "上海";
            } else{
                city = "南京";
            }
            int salary = RandomUtils.nextInt(12000, 32000);

            String dt = RandomUtils.nextInt(2010,2020) + "-" + StringUtils.leftPad(RandomUtils.nextInt(1,13)+"",2,"0") + "-" + StringUtils.leftPad(RandomUtils.nextInt(1,31)+"",2,"0");

            bw.write(stu_id+","+name+","+age+","+gender+","+city+","+salary+","+dt);
            bw.newLine();

        }


        bw.flush();
        bw.close();

    }

}
